//
//  KZLoginVC.swift
//  BoyeStore
//
//  Created by 朱凯 on 2018/6/23.
//  Copyright © 2018年 itboye. All rights reserved.
//

import UIKit

import RxCocoa
import RxSwift



class KZLoginVC: KZBaseViewController {
    
    let bag = DisposeBag()
    
    let statusBarBgView = UIView()

    override func viewDidLoad() {
        super.viewDidLoad()

        setupUI()
        
        UIApplication.shared.statusBarStyle = .default
        
    }
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        setNavigationBackgroungAttributes(naviTranslucent: true,
                                          naviBgColor: .clear)
    }
    
 
 

    private func setupUI() {
        
        
        statusBarBgView.backgroundColor = kThemeColor
        view.addSubview(statusBarBgView)
        statusBarBgView.snp.makeConstraints { (m) in
            m.left.top.right.equalTo(0)
            m.height.equalTo(UIApplication.shared.statusBarFrame.height)
        }
        
        let logoView = UIImageView()
        logoView.image = #imageLiteral(resourceName: "登录-淘宝")
        view.addSubview(logoView)
        logoView.snp.makeConstraints { (m) in
            m.width.height.equalTo(150)
            m.centerX.equalTo(view)
            m.top.equalTo(100)
        }
        
        let button = UIButton(type: .custom)
        button.setImage(#imageLiteral(resourceName: "登录-淘宝"), for: .normal)
        view.addSubview(button)
        button.snp.makeConstraints { (m) in
            m.width.height.equalTo(70)
            m.centerX.equalTo(view)
            m.top.equalTo(view.snp.centerY)
        }
        button.rx.tap.bind { [weak self] in
            
//            let session = ALBBSession.sharedInstance()
//            if let isLogin = session?.isLogin(), isLogin == true {
//                let tip = session?.getUser().albbUserDescription()
//                print(tip)
//            } else {
//                ALBBSDK.sharedInstance().auth(self, successCallback: {
//                    print($0)
//                }, failureCallback: {
//                    print($0, $1)
//                })
//            }
//
            let vc = KZLoginBindPhoneVC()
            self?.navigationController?.pushViewController(vc, animated: true)
        }.disposed(by: bag)
        
        let label = UILabel()
        label.textColor = UIColor.black
        label.textAlignment = .center
        label.text = "淘宝登录"
        label.font = UIFont.systemFont(ofSize: 15)
        view.addSubview(label)
        label.snp.makeConstraints { (m) in
            m.left.right.equalTo(0)
            m.top.equalTo(button.snp.bottom).offset(20)
        }
    }

}
